<template>
  <div>
    <headerTop :data="txtTime"></headerTop>
    <div class="imgContent" v-if="data.img_url">
      <div class="imgText">
        <img :src="data.img_url" alt="" @click="show = true" />
        <div>{{ data.title }} | {{ data.pic_info }}</div>
        <div>{{ data.forward }}</div>
        <div>{{ data.words_info }}</div>
      </div>
      <div class="imgBottom">
        <div>
          <span><van-icon name="umbrella-circle"></van-icon></span>
          <span>小记</span>
        </div>
        <div class="imgicon">
          <van-icon name="edit" />
          <van-icon name="bookmark-o" style="margin-left: 10px" />
          <van-icon name="like-o" style="margin: 0 10px" /><span>{{
            data.like_count
          }}</span>
          <van-icon name="share-o" />
        </div>
      </div>
    </div>
    <van-overlay :show="show" @click="show = false">
      <div class="wrapper">
        <div class="block">
          <div>{{ data.volume }}</div>
          <img :src="data.img_url" alt="" />
          <div>{{ data.title }} | {{ data.pic_info }}</div>
        </div>
      </div>
    </van-overlay>
  </div>
</template>

<script>
import { getIamgeText } from "@/api/articlesPage";
import headerTop from "@/components/headerTop";
// import { getIamgeText } from "@/api/articlesPage";
export default {
  name: "imageText",
  components: {
    headerTop,
  },
  data() {
    return {
      txtTime: this.$route.params.id,
      data: {},
      show: false,
    };
  },
  created() {
    this.getImgText();
  },
  methods: {
    async getImgText() {
      const { data } = await getIamgeText(this.txtTime);
      this.data = data;
      console.log("图文详情", data);
    },
  },
};
</script>

<style lang="less" scoped>
.wrapper {
  width: 375px;
  padding: 0 15px;
  height: 100%;
  color: #ffffff;
  .block {
    margin-top: 60px;
    img {
      width: 100%;
    }
  }
}

.imgContent {
  width: 375px;
  padding: 0 15px;
  padding-top: 10px;
  margin-top: 30px;

  .imgText {
    height: 400px;
    height: 100%;
    border-radius: 5px;
    outline: solid;
    outline-width: 1px;
    outline-color: #e6e6e6;
    box-sizing: border-box;
    position: relative;
    img {
      width: 100%;
      border-top-left-radius: 5px;
      border-top-right-radius: 5px;
      overflow: hidden;
    }
    & > :nth-child(2) {
      text-align: center;
      color: #c6c6c6;
      font-size: 12px;
      margin-bottom: 20px;
    }
    & > :nth-child(3) {
      padding: 0px 15px 40px 15px;
      font-size: 14px;
    }
    & > :nth-child(4) {
      font-size: 12px;
      color: #c6c6c6;
      position: absolute;
      bottom: 20px;
      left: 50%;
      transform: translateX(-50%);
    }
  }
  .imgBottom {
    display: flex;
    justify-content: space-between;
    padding: 10px 0 15px 0;
    div:nth-child(1) {
      color: black;
    }
    div:nth-child(2) {
      color: black;
    }
  }
}
</style>